/*******************/
/* drop everything */
/*******************/

drop sequence S_OWNED;
drop sequence S_RATE;
drop table RATE;
drop table OWNED;
drop table APPUSER;
drop table CURRENCY;

/*********************/
/* create everything */
/*********************/

create sequence S_OWNED;
create sequence S_RATE;

create table CURRENCY (
   CODE                 VARCHAR2(50)                    not null,
   NAME                 VARCHAR2(50)                    not null,
   constraint PK_CURRENCY primary key (CODE)
);

create table APPUSER (
   LOGIN                VARCHAR2(50)                    not null,
   PASSWORD             VARCHAR2(50)                    not null,
   FIRSTNAME            VARCHAR2(50)                    not null,
   LASTNAME             VARCHAR2(50)                    not null,
   MAIL                 VARCHAR2(50)                    not null,
   ADMIN                SMALLINT                        not null,
   ENABLED              SMALLINT                        not null,
   CODE                 VARCHAR2(50)                    not null,
   constraint PK_APPUSER primary key (LOGIN),
   constraint FK_USER_CURRENCY foreign key (CODE) references CURRENCY (CODE)
);

create table OWNED (
   IDOWNED              NUMBER(6, 0)                    not null,
   LOGIN                VARCHAR2(50)                    not null,
   CODE                 VARCHAR2(50)                    not null,
   UNITS                NUMBER(10, 2)                   not null,
   constraint PK_OWNED primary key (IDOWNED),
   constraint FK_OWNED_APPUSER foreign key (LOGIN) references APPUSER (LOGIN),
   constraint FK_OWNED_CURRENCY foreign key (CODE) references CURRENCY (CODE)
);

create table RATE (
   IDRATE               NUMBER(6, 0)                    not null,
   CODE1                VARCHAR2(50)                    not null,
   CODE2                VARCHAR2(50)                    not null,
   ASK                  NUMBER(8, 4)                    not null,
   BID                  NUMBER(8, 4)                    not null,
   EVOLUTION            NUMBER(6, 2)                    not null,
   RATEDATE             TIMESTAMP(6)                    not null,
   constraint PK_RATE primary key (IDRATE),
   constraint FK_RATE_CURRENCY foreign key (CODE1) references CURRENCY (CODE),
   constraint FK_RATE_CURRENCY2 foreign key (CODE2) references CURRENCY (CODE)
);

/*****************/
/* fill the data */
/*****************/

INSERT INTO CURRENCY (CODE, NAME)
   SELECT 'EUR', 'European Union Euro' FROM DUAL UNION ALL
   SELECT 'USD', 'United States Dollar' FROM DUAL UNION ALL
   SELECT 'JPY', 'Japan Yen' FROM DUAL UNION ALL
   SELECT 'CHF', 'Switzerland Franc' FROM DUAL UNION ALL
   SELECT 'GBP', 'Great Britain Pound' FROM DUAL;

INSERT INTO APPUSER(LOGIN, PASSWORD, FIRSTNAME, LASTNAME, MAIL, ADMIN, ENABLED, CODE)
   SELECT 'admin', 'admin', 'John', 'DOE', 'john.doe@foo-bar-foo-bar.com', 1, 1, 'USD' FROM DUAL UNION ALL
   SELECT 'cooperb', 'password', 'Bob', 'COOPER', 'bob.cooper@foo-bar-foo-bar.com', 0, 1, 'EUR' FROM DUAL;

INSERT INTO OWNED(IDOWNED, LOGIN, CODE, UNITS)
   SELECT S_OWNED.NEXTVAL, 'admin', 'USD', 50000 FROM DUAL;
INSERT INTO OWNED(IDOWNED, LOGIN, CODE, UNITS)
   SELECT S_OWNED.NEXTVAL, 'admin', 'CHF', 10000 FROM DUAL;
INSERT INTO OWNED(IDOWNED, LOGIN, CODE, UNITS)
   SELECT S_OWNED.NEXTVAL, 'admin', 'GBP', 20000 FROM DUAL;
INSERT INTO OWNED(IDOWNED, LOGIN, CODE, UNITS)
   SELECT S_OWNED.NEXTVAL, 'admin', 'EUR', 1000 FROM DUAL;
INSERT INTO OWNED(IDOWNED, LOGIN, CODE, UNITS)
   SELECT S_OWNED.NEXTVAL, 'cooperb', 'EUR', 10000 FROM DUAL;

INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'USD', 1.2946, 0.9997 * 1.2946, 0, TO_DATE('20130318', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'USD', 1.2862, 0.9997 * 1.2862, (1.2862 / 1.2946 - 1) * 100, TO_DATE('20130319', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'USD', 1.2935, 0.9997 * 1.2935, (1.2935 / 1.2862 - 1) * 100, TO_DATE('20130320', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'USD', 1.2894, 0.9997 * 1.2894, (1.2894 / 1.2935 - 1) * 100, TO_DATE('20130321', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'USD', 1.2993, 0.9997 * 1.2993, (1.2993 / 1.2894 - 1) * 100, TO_DATE('20130322', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'USD', 1.2856, 0.9997 * 1.2856, (1.2856 / 1.2993 - 1) * 100, TO_DATE('20130325', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'USD', 1.2860, 0.9997 * 1.2860, (1.2860 / 1.2856 - 1) * 100, TO_DATE('20130326', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'USD', 1.2777, 0.9997 * 1.2777, (1.2777 / 1.2860 - 1) * 100, TO_DATE('20130327', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'USD', 1.2815, 0.9997 * 1.2815, (1.2815 / 1.2777 - 1) * 100, TO_DATE('20130328', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'USD', 1.2804, 0.9997 * 1.2804, (1.2804 / 1.2815 - 1) * 100, TO_DATE('20130329', 'YYYYMMDD') FROM DUAL;

INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'JPY', 123.1875, 0.9997 * 123.1875, 0, TO_DATE('20130318', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'JPY', 122.4080, 0.9997 * 122.4080, (122.4080 / 123.1875 - 1) * 100, TO_DATE('20130319', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'JPY', 124.3755, 0.9997 * 124.3755, (124.3755 / 122.4080 - 1) * 100, TO_DATE('20130320', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'JPY', 122.4455, 0.9997 * 122.4455, (122.4455 / 124.3755 - 1) * 100, TO_DATE('20130321', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'JPY', 122.6530, 0.9997 * 122.6530, (122.6530 / 122.4455 - 1) * 100, TO_DATE('20130322', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'JPY', 120.9260, 0.9997 * 120.9260, (120.9260 / 122.6530 - 1) * 100, TO_DATE('20130325', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'JPY', 121.5815, 0.9997 * 121.5815, (121.5815 / 120.9260 - 1) * 100, TO_DATE('20130326', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'JPY', 120.5745, 0.9997 * 120.5745, (120.5745 / 121.5815 - 1) * 100, TO_DATE('20130327', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'JPY', 120.6440, 0.9997 * 120.6440, (120.6440 / 120.5745 - 1) * 100, TO_DATE('20130328', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'JPY', 120.4550, 0.9997 * 120.4550, (120.4550 / 120.6440 - 1) * 100, TO_DATE('20130329', 'YYYYMMDD') FROM DUAL;

INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'CHF', 1.2258, 0.9997 * 1.2258, 0, TO_DATE('20130318', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'CHF', 1.2192, 0.9997 * 1.2192, (1.2192 / 1.2258 - 1) * 100, TO_DATE('20130319', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'CHF', 1.2227, 0.9997 * 1.2227, (1.2227 / 1.2192 - 1) * 100, TO_DATE('20130320', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'CHF', 1.2213, 0.9997 * 1.2213, (1.2213 / 1.2227 - 1) * 100, TO_DATE('20130321', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'CHF', 1.2221, 0.9997 * 1.2221, (1.2221 / 1.2213 - 1) * 100, TO_DATE('20130322', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'CHF', 1.2194, 0.9997 * 1.2194, (1.2194 / 1.2221 - 1) * 100, TO_DATE('20130325', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'CHF', 1.2194, 0.9997 * 1.2194, (1.2194 / 1.2194 - 1) * 100, TO_DATE('20130326', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'CHF', 1.2189, 0.9997 * 1.2189, (1.2189 / 1.2194 - 1) * 100, TO_DATE('20130327', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'CHF', 1.2169, 0.9997 * 1.2169, (1.2169 / 1.2189 - 1) * 100, TO_DATE('20130328', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'CHF', 1.2170, 0.9997 * 1.2170, (1.2170 / 1.2169 - 1) * 100, TO_DATE('20130329', 'YYYYMMDD') FROM DUAL;

INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'GBP', 0.8577, 0.9997 * 0.8577, 0, TO_DATE('20130318', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'GBP', 0.8520, 0.9997 * 0.8520, (0.8520 / 0.8577 - 1) * 100, TO_DATE('20130319', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'GBP', 0.8568, 0.9997 * 0.8568, (0.8568 / 0.8520 - 1) * 100, TO_DATE('20130320', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'GBP', 0.8501, 0.9997 * 0.8501, (0.8501 / 0.8568 - 1) * 100, TO_DATE('20130321', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'GBP', 0.8528, 0.9997 * 0.8528, (0.8528 / 0.8501 - 1) * 100, TO_DATE('20130322', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'GBP', 0.8471, 0.9997 * 0.8471, (0.8471 / 0.8528 - 1) * 100, TO_DATE('20130325', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'GBP', 0.8482, 0.9997 * 0.8482, (0.8482 / 0.8471 - 1) * 100, TO_DATE('20130326', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'GBP', 0.8447, 0.9997 * 0.8447, (0.8447 / 0.8482 - 1) * 100, TO_DATE('20130327', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'GBP', 0.8436, 0.9997 * 0.8436, (0.8436 / 0.8447 - 1) * 100, TO_DATE('20130328', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'EUR', 'GBP', 0.8433, 0.9997 * 0.8433, (0.8433 / 0.8436 - 1) * 100, TO_DATE('20130329', 'YYYYMMDD') FROM DUAL;

INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'USD', 'JPY', 95.3450, 0.9997 * 95.3450, 0, TO_DATE('20130318', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'USD', 'JPY', 95.0550, 0.9997 * 95.0550, (95.0550 / 95.3450 - 1) * 100, TO_DATE('20130319', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'USD', 'JPY', 96.0850, 0.9997 * 96.0850, (96.0850 / 95.0550 - 1) * 100, TO_DATE('20130320', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'USD', 'JPY', 95.1250, 0.9997 * 95.1250, (95.1250 / 96.0850 - 1) * 100, TO_DATE('20130321', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'USD', 'JPY', 94.4800, 0.9997 * 94.4800, (94.4800 / 95.1250 - 1) * 100, TO_DATE('20130322', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'USD', 'JPY', 94.1650, 0.9997 * 94.1650, (94.1650 / 94.4800 - 1) * 100, TO_DATE('20130325', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'USD', 'JPY', 94.5450, 0.9997 * 94.5450, (94.5450 / 94.1650 - 1) * 100, TO_DATE('20130326', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'USD', 'JPY', 94.3350, 0.9997 * 94.3350, (94.3350 / 94.5450 - 1) * 100, TO_DATE('20130327', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'USD', 'JPY', 94.2650, 0.9997 * 94.2650, (94.2650 / 94.3350 - 1) * 100, TO_DATE('20130328', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'USD', 'JPY', 94.0650, 0.9997 * 94.0650, (94.0650 / 94.2650 - 1) * 100, TO_DATE('20130329', 'YYYYMMDD') FROM DUAL;

INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'USD', 'CHF', 0.9469, 0.9997 * 0.9469, 0, TO_DATE('20130318', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'USD', 'CHF', 0.9478, 0.9997 * 0.9478, (0.9478 / 0.9469 - 1) * 100, TO_DATE('20130319', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'USD', 'CHF', 0.9453, 0.9997 * 0.9453, (0.9453 / 0.9478 - 1) * 100, TO_DATE('20130320', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'USD', 'CHF', 0.9471, 0.9997 * 0.9471, (0.9471 / 0.9453 - 1) * 100, TO_DATE('20130321', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'USD', 'CHF', 0.9407, 0.9997 * 0.9407, (0.9407 / 0.9471 - 1) * 100, TO_DATE('20130322', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'USD', 'CHF', 0.9484, 0.9997 * 0.9484, (0.9484 / 0.9407 - 1) * 100, TO_DATE('20130325', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'USD', 'CHF', 0.9481, 0.9997 * 0.9481, (0.9481 / 0.9484 - 1) * 100, TO_DATE('20130326', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'USD', 'CHF', 0.9539, 0.9997 * 0.9539, (0.9539 / 0.9481 - 1) * 100, TO_DATE('20130327', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'USD', 'CHF', 0.9496, 0.9997 * 0.9496, (0.9496 / 0.9539 - 1) * 100, TO_DATE('20130328', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'USD', 'CHF', 0.9505, 0.9997 * 0.9505, (0.9505 / 0.9496 - 1) * 100, TO_DATE('20130329', 'YYYYMMDD') FROM DUAL;

INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'USD', 'GBP', 0.6625, 0.9997 * 0.6625, 0, TO_DATE('20130318', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'USD', 'GBP', 0.6624, 0.9997 * 0.6624, (0.6624 / 0.6625 - 1) * 100, TO_DATE('20130319', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'USD', 'GBP', 0.6624, 0.9997 * 0.6624, (0.6624 / 0.6624 - 1) * 100, TO_DATE('20130320', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'USD', 'GBP', 0.6593, 0.9997 * 0.6593, (0.6593 / 0.6624 - 1) * 100, TO_DATE('20130321', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'USD', 'GBP', 0.6565, 0.9997 * 0.6565, (0.6565 / 0.6593 - 1) * 100, TO_DATE('20130322', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'USD', 'GBP', 0.6590, 0.9997 * 0.6590, (0.6590 / 0.6565 - 1) * 100, TO_DATE('20130325', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'USD', 'GBP', 0.6595, 0.9997 * 0.6595, (0.6595 / 0.6590 - 1) * 100, TO_DATE('20130326', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'USD', 'GBP', 0.6610, 0.9997 * 0.6610, (0.6610 / 0.6595 - 1) * 100, TO_DATE('20130327', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'USD', 'GBP', 0.6583, 0.9997 * 0.6583, (0.6583 / 0.6610 - 1) * 100, TO_DATE('20130328', 'YYYYMMDD') FROM DUAL;
INSERT INTO RATE (IDRATE, CODE1, CODE2, ASK, BID, EVOLUTION, RATEDATE)
   SELECT S_RATE.NEXTVAL, 'USD', 'GBP', 0.6584, 0.9997 * 0.6584, (0.6584 / 0.6583 - 1) * 100, TO_DATE('20130329', 'YYYYMMDD') FROM DUAL;
